package com.game.action;

import com.game.json.JSONObject;
import com.game.server.Action;
import com.game.server.SocketThread;
import com.game.share.IOPackage;
import com.game.share.Util;

public class ValidateAction implements Action {

	@Override
	public IOPackage execute(SocketThread st, String jsonString) {
		try {
			JSONObject jsonObject = new JSONObject(jsonString);

			String clientID = jsonObject.getString("clientID");
			if (clientID.length() > 0) {
				return new IOPackage(IOPackage.PackageType.RESPONSE,
						Util.stringToByte("Success Validate"));
			} else {
				return new IOPackage(IOPackage.PackageType.RESPONSE,
						Util.stringToByte("Failed Validate"));
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return IOPackage.EMPRY_RESPONSE;
	}

}
